package com.mini.config;

import com.sunlands.gateway.ApiGatewayClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author zhangxiaobin
 * @title: ApiGateWayClientConfig
 * @description: TODO
 * @date 2019/9/1820:25
 */
@Configuration
public class ApiGateWayClientConfig {

    @Value("${sunlands.gateway.appKey}")
    String sunlandsGatewayAppKey;

    @Value("${sunlands.gateway.appSecret}")
    String sunlandsGatewayAppSecret;

    @Value("${sunlands.gateway.host}")
    String sunlandsGatewayHost;

    @Value("${sunlands.sms.host}")
    String smsGatewayHost;

    @Value("${sunlands.sms.appKey}")
    String smsGatewayAppKey;

    @Value("${sunlands.sms.appSecret}")
    String smsGatewayAppSecret;

    @Bean
    public ApiGatewayClient apiGatewayClient(){
        return new ApiGatewayClient.Builder()
                .kongUrl(sunlandsGatewayHost)
                .appKey(sunlandsGatewayAppKey)
                .appSecret(sunlandsGatewayAppSecret)
                .build();
    }

    @Bean
    public ApiGatewayClient smsGatewayClient(){
        return new ApiGatewayClient.Builder()
                .kongUrl(smsGatewayHost)
                .appKey(smsGatewayAppKey)
                .appSecret(smsGatewayAppSecret)
                .build();
    }

}
